This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
If you would like to play around with the visual design of the document, there are numerous templates to choose from. These can be specified into themes and highlights, and can be selected in the YAML box at the start of this document.
For more information on styling, please check the following link: (https://bookdown.org/yihui/rmarkdown/html-document.html#appearance-and-style).
In this particular analysis, we aiming to present how the penguins
differ from species to species, and from island to island. We want to
show case how these differences are present across the 4 measures
collected bill_length_mm, bill_depth_mm,
flipper_length_mm, and body_mass_g.
To help users navigate our beautiful document with greater ease, and
to provide an element of interactivity, we will be using
{.tabset} on our headers. Behind the scenes, it operates on
a hierarchical structure, which is dependent on the level of your
heading. This gets a bit weird and theoretical, so playing around with
it in your own work is the best approach to getting a feel for it. But
if you would like more information, please check the following link: https://bookdown.org/yihui/rmarkdown-cookbook/html-tabs.html
| Characteristic | Adelie, N = 1521 | Chinstrap, N = 681 | Gentoo, N = 1241 |
|---|---|---|---|
| island | |||
| Biscoe | 44 (29%) | 0 (0%) | 124 (100%) |
| Dream | 56 (37%) | 68 (100%) | 0 (0%) |
| Torgersen | 52 (34%) | 0 (0%) | 0 (0%) |
| Bill Length (mm) | 38.8 (2.7) | 48.8 (3.3) | 47.5 (3.1) |
| Unknown | 1 | 0 | 1 |
| Bill Depth(mm) | 18.35 (1.22) | 18.42 (1.14) | 14.98 (0.98) |
| Unknown | 1 | 0 | 1 |
| Flipper Length(mm) | 190 (7) | 196 (7) | 217 (6) |
| Unknown | 1 | 0 | 1 |
| Body Mass(g) | 3,701 (459) | 3,733 (384) | 5,076 (504) |
| Unknown | 1 | 0 | 1 |
| sex | |||
| female | 73 (50%) | 34 (50%) | 58 (49%) |
| male | 73 (50%) | 34 (50%) | 61 (51%) |
| Unknown | 6 | 0 | 5 |
| 1 n (%); Mean (SD) | |||
| Characteristic | Biscoe, N = 1681 | Dream, N = 1241 | Torgersen, N = 521 |
|---|---|---|---|
| species | |||
| Adelie | 44 (26%) | 56 (45%) | 52 (100%) |
| Chinstrap | 0 (0%) | 68 (55%) | 0 (0%) |
| Gentoo | 124 (74%) | 0 (0%) | 0 (0%) |
| Bill Length (mm) | 45.3 (4.8) | 44.2 (6.0) | 39.0 (3.0) |
| Unknown | 1 | 0 | 1 |
| Bill Depth(mm) | 15.87 (1.82) | 18.34 (1.13) | 18.43 (1.34) |
| Unknown | 1 | 0 | 1 |
| Flipper Length(mm) | 210 (14) | 193 (8) | 191 (6) |
| Unknown | 1 | 0 | 1 |
| Body Mass(g) | 4,716 (783) | 3,713 (417) | 3,706 (445) |
| Unknown | 1 | 0 | 1 |
| sex | |||
| female | 80 (49%) | 61 (50%) | 24 (51%) |
| male | 83 (51%) | 62 (50%) | 23 (49%) |
| Unknown | 5 | 1 | 5 |
| 1 n (%); Mean (SD) | |||
| Characteristic | female, N = 1651 | male, N = 1681 |
|---|---|---|
| species | ||
| Adelie | 73 (44%) | 73 (43%) |
| Chinstrap | 34 (21%) | 34 (20%) |
| Gentoo | 58 (35%) | 61 (36%) |
| island | ||
| Biscoe | 80 (48%) | 83 (49%) |
| Dream | 61 (37%) | 62 (37%) |
| Torgersen | 24 (15%) | 23 (14%) |
| Bill Length (mm) | 42.1 (4.9) | 45.9 (5.4) |
| Bill Depth(mm) | 16.43 (1.80) | 17.89 (1.86) |
| Flipper Length(mm) | 197 (13) | 205 (15) |
| Body Mass(g) | 3,862 (666) | 4,546 (788) |
| 1 n (%); Mean (SD) | ||
We can also report our data in text. It will look ugly here, but will be magical in the finished document. The in-line coding is achieved through using backticks and including the letter “r” (as seen below). To simplify process, we first use some data manipulation to define items we want to communicate. The end product allows us to produce transparent analysis, and minimises the risk of typos. As a bonus, it also allows us to re-run our analysis at a much quicker rate if our data is updated!
Once again, we will use the {.tabset} to allow our
audience to quickly navigate the document. However, this time we are
also using {.tabset-pills} to change the appearance. Pick
and choose which visual style you think is most appropriate for your
presentation. (Playing with the themes will change the appearance of the
tabsets and tabset-pills as well, so there is plenty of scope for
experimenting).
The mean weight of the Adelie penguins is 3700.66g (sd = 458.57).
The mean weight of the Chinstrap penguins is 3733.09g (sd = 384.34).
The mean weight of the Gentoo penguins is 5076.02g (sd = 504.12).
The mean weight of the penguins on Biscoe island is 4716.02g (sd = 782.86).
The mean weight of the penguins on Dream island is 3712.9g (sd = 384.34).
The mean weight of the penguins on Torgersen island is 3706.37g (sd = 504.12).
| Characteristic | Adelie, N = 1521 | Chinstrap, N = 681 | Gentoo, N = 1241 | Test Statistic | p-value2 |
|---|---|---|---|---|---|
| Body Mass(g) | 3,701 (459) | 3,733 (384) | 5,076 (504) | 343.6263 | <0.001 |
| 1 Mean (SD) | |||||
| 2 One-way ANOVA | |||||
One way ANOVA on differences of body mass by species was significant (F(2,339) = 343.6262752, p < 0.001).
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
| Characteristic | Biscoe, N = 1681 | Dream, N = 1241 | Torgersen, N = 521 | Test Statistic | p-value2 |
|---|---|---|---|---|---|
| Body Mass(g) | 4,716 (783) | 3,713 (417) | 3,706 (445) | 110.008 | <0.001 |
| 1 Mean (SD) | |||||
| 2 One-way ANOVA | |||||
One way ANOVA on differences of body mass by Island was significant (F(2,339) = 110.0079651, p < 0.001).
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
Here we will make use of the plotly package to make our
plots interactive. The good news is, this is super simple if you already
know how to use ggplot. Simply assign your plot to an
object, and then wrap it in the ggplotly() function. The
appearance of your plot may change compared to your original design as
its converted to a plotly item, so so experimenting is
recommended. For more information and vignettes, check the following
link: https://plotly.com/ggplot2/
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
## Warning: Removed 2 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 2 rows containing non-finite values (`stat_ydensity()`).
## Warning: Groups with fewer than two data points have been dropped.
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).